@@ -39,7 +39,7 @@ gem 'hypdf', '~> 1.0.10' # PDFInfoAgent |
||
39 | 39 |
|
40 | 40 |
# Weibo Agents |
41 | 41 |
# FIXME needs to loosen omniauth dependency |
42 |
-#gem 'weibo_2', github: 'cantino/weibo_2', branch: 'master' |
|
42 |
+gem 'weibo_2', github: 'dsander/weibo_2', branch: 'master' |
|
43 | 43 |
|
44 | 44 |
# GoogleCalendarPublishAgent |
45 | 45 |
gem "google-api-client", require: 'google/api_client' |
@@ -18,6 +18,17 @@ GIT |
||
18 | 18 |
delayed_job (>= 3.0, < 5) |
19 | 19 |
|
20 | 20 |
GIT |
21 |
+ remote: git://github.com/dsander/weibo_2.git |
|
22 |
+ revision: e5b77f21a7e9a666b582c48e16b1e96fca198cf8 |
|
23 |
+ branch: master |
|
24 |
+ specs: |
|
25 |
+ weibo_2 (0.1.7) |
|
26 |
+ hashie (~> 3) |
|
27 |
+ multi_json (~> 1) |
|
28 |
+ oauth2 (~> 1) |
|
29 |
+ rest-client (~> 1.8) |
|
30 |
+ |
|
31 |
+GIT |
|
21 | 32 |
remote: git://github.com/lostisland/faraday_middleware.git |
22 | 33 |
revision: c5836ae55857272732b33eb0e0a98d60e995a376 |
23 | 34 |
branch: master |
@@ -683,6 +694,7 @@ DEPENDENCIES |
||
683 | 694 |
vcr |
684 | 695 |
web-console |
685 | 696 |
webmock (~> 1.17.4) |
697 |
+ weibo_2! |
|
686 | 698 |
wunderground (~> 1.2.0) |
687 | 699 |
xmpp4r (~> 0.5.6) |
688 | 700 |
|
@@ -76,4 +76,10 @@ module LiquidDroppable |
||
76 | 76 |
URIDrop.new(self) |
77 | 77 |
end |
78 | 78 |
end |
79 |
+ |
|
80 |
+ class ::ActiveRecord::Associations::CollectionProxy |
|
81 |
+ def to_liquid |
|
82 |
+ self.to_a.to_liquid |
|
83 |
+ end |
|
84 |
+ end |
|
79 | 85 |
end |
@@ -8,6 +8,8 @@ module Agents |
||
8 | 8 |
elsif params[:source_ids] |
9 | 9 |
Event.where(agent_id: current_user.agents.where(id: params[:source_ids]).pluck(:id)) |
10 | 10 |
.order("id DESC").limit(5) |
11 |
+ else |
|
12 |
+ [] |
|
11 | 13 |
end |
12 | 14 |
|
13 | 15 |
render layout: false |
@@ -72,6 +72,7 @@ class ApplicationController < ActionController::Base |
||
72 | 72 |
params[:agent].permit(:memory, :name, :type, :schedule, :disabled, :keep_events_for, :propagate_immediately, :drop_pending_events, :service_id, |
73 | 73 |
source_ids: [], receiver_ids: [], scenario_ids: [], controller_ids: [], control_target_ids: []).tap do |agent_params| |
74 | 74 |
agent_params[:options] = options if options |
75 |
+ agent_params[:options].permit! if agent_params[:options].respond_to?(:permit!) |
|
75 | 76 |
end |
76 | 77 |
end |
77 | 78 |
end |
@@ -4,7 +4,7 @@ class ScenarioImportsController < ApplicationController |
||
4 | 4 |
end |
5 | 5 |
|
6 | 6 |
def create |
7 |
- @scenario_import = ScenarioImport.new(params[:scenario_import]) |
|
7 |
+ @scenario_import = ScenarioImport.new(scenario_import_params) |
|
8 | 8 |
@scenario_import.set_user(current_user) |
9 | 9 |
|
10 | 10 |
if @scenario_import.valid? && @scenario_import.import_confirmed? && @scenario_import.import |
@@ -13,4 +13,13 @@ class ScenarioImportsController < ApplicationController |
||
13 | 13 |
render action: "new" |
14 | 14 |
end |
15 | 15 |
end |
16 |
+ |
|
17 |
+ private |
|
18 |
+ |
|
19 |
+ def scenario_import_params |
|
20 |
+ merges = params[:scenario_import].delete(:merges) |
|
21 |
+ params.require(:scenario_import).permit(:url, :data, :file, :do_import) do |params| |
|
22 |
+ params[:merges] = merges |
|
23 |
+ end |
|
24 |
+ end |
|
16 | 25 |
end |
@@ -117,4 +117,10 @@ module ApplicationHelper |
||
117 | 117 |
def agent_type_to_human(type) |
118 | 118 |
type.gsub(/^.*::/, '').underscore.humanize.titleize |
119 | 119 |
end |
120 |
+ |
|
121 |
+ private |
|
122 |
+ |
|
123 |
+ def user_omniauth_authorize_path(provider) |
|
124 |
+ send "user_#{provider}_omniauth_authorize_path" |
|
125 |
+ end |
|
120 | 126 |
end |
@@ -6,7 +6,7 @@ class AgentPropagateJob < ActiveJob::Base |
||
6 | 6 |
end |
7 | 7 |
|
8 | 8 |
def self.can_enqueue? |
9 |
- case queue_adapter.name # not using class since it would load adapter dependent gems |
|
9 |
+ case queue_adapter.class.name # not using class since it would load adapter dependent gems |
|
10 | 10 |
when 'ActiveJob::QueueAdapters::DelayedJobAdapter' |
11 | 11 |
return Delayed::Job.where(failed_at: nil, queue: 'propagation').count == 0 |
12 | 12 |
when 'ActiveJob::QueueAdapters::ResqueAdapter' |
@@ -93,7 +93,7 @@ describe Agents::DryRunsController do |
||
93 | 93 |
agent.save! |
94 | 94 |
url_from_event = "http://xkcd.com/?from_event=1".freeze |
95 | 95 |
expect { |
96 |
- post :create, params: {agent_id: agent, event: { url: url_from_event }} |
|
96 |
+ post :create, params: {agent_id: agent, event: { url: url_from_event }.to_json} |
|
97 | 97 |
}.not_to change { |
98 | 98 |
[users(:bob).agents.count, users(:bob).events.count, users(:bob).logs.count, agent.name, agent.updated_at] |
99 | 99 |
} |
@@ -142,7 +142,7 @@ describe ScenariosController do |
||
142 | 142 |
it 'adds an agent to the scenario' do |
143 | 143 |
expect { |
144 | 144 |
post :update, params: {:id => scenarios(:bob_weather).to_param, :scenario => { :name => "new_name", :public => "1", agent_ids: scenarios(:bob_weather).agent_ids + [agents(:bob_website_agent).id] }} |
145 |
- }.to change { scenarios(:bob_weather).agent_ids.length }.by(1) |
|
145 |
+ }.to change { scenarios(:bob_weather).reload.agent_ids.length }.by(1) |
|
146 | 146 |
end |
147 | 147 |
end |
148 | 148 |
|
@@ -144,8 +144,12 @@ bob_manual_event_agent: |
||
144 | 144 |
bob_basecamp_agent: |
145 | 145 |
type: Agents::BasecampAgent |
146 | 146 |
user: bob |
147 |
+ name: "bob basecamp agent" |
|
147 | 148 |
service: generic |
148 | 149 |
guid: <%= SecureRandom.hex %> |
150 |
+ options: <%= { |
|
151 |
+ :project_id => "12345", |
|
152 |
+ }.to_json.inspect %> |
|
149 | 153 |
|
150 | 154 |
bob_csv_agent: |
151 | 155 |
type: Agents::CsvAgent |
@@ -156,8 +160,12 @@ bob_csv_agent: |
||
156 | 160 |
jane_basecamp_agent: |
157 | 161 |
type: Agents::BasecampAgent |
158 | 162 |
user: jane |
163 |
+ name: "jane basecamp agent" |
|
159 | 164 |
service: generic |
160 | 165 |
guid: <%= SecureRandom.hex %> |
166 |
+ options: <%= { |
|
167 |
+ :project_id => "12345", |
|
168 |
+ }.to_json.inspect %> |
|
161 | 169 |
|
162 | 170 |
|
163 | 171 |
bob_data_output_agent: |